import request from "./index";

/**
 * 获取个人特色
 * @param userId {string | number}
 * @returns {Promise}
 */
export function getIndividualList(userId) {
  return request({
    url: "/indiv/list",
    params: {
      userId
    }
  })
}

/**
 * 创建一条简介
 * @param indivKey {string}
 * @param indivValue {string}
 * @param mini {string | number}
 * @returns {Promise}
 */
export function createIndividual(indivKey, indivValue, mini) {
  return request({
    url: "/indiv",
    method: "POST",
    data: {
      indivKey,
      indivValue,
      mini
    }
  })
}

/**
 * 更新一条简介
 * @param indivId {string | number}
 * @param indivKey {string}
 * @param indivValue {string}
 * @param mini {string | number}
 * @returns {Promise}
 */
export function updateIndividual(indivId, indivKey, indivValue, mini) {
  return request({
    url: "/indiv",
    method: "PATCH",
    data: {
      indivId,
      indivKey,
      indivValue,
      mini
    }
  })
}

/**
 * 删除一条简介
 * @param indivId {string | number}
 * @returns {Promise}
 */
export function deleteIndividual(indivId) {
  return request({
    url: "indiv",
    method: "DELETE",
    data: {
      indivId
    }
  })
}